package MRdemo;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableComparable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class ReWriteKey implements WritableComparable<ReWriteKey>{
    private int num;
    public ReWriteKey() {
        super();
    }

    public ReWriteKey(int num) {
        this.num=num;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public int compareTo(ReWriteKey rwk) {
        return (int)(this.num - rwk.getNum());
    }

    public void write(DataOutput out) throws IOException {
        out.writeInt(num);
    }

    public void readFields(DataInput in) throws IOException {
        num = in.readInt();
    }


}
